<?php
/**
 * 用户取消关注记录
 */
namespace bc\model;

use bc\ar\MActiveRecord;

class UnsubscribeModel extends MActiveRecord
{
	public static function tableName()
	{
		return '{{%unsubscribe_log}}';
	}
	
	
	public function getListByOpenid($params, $page = null, $pageSize = null)
	{
		
	}
	
	public function getTotalByOpenid($condition)
	{
		if(!empty($condition))
		{
			$ar = $this->find ()->select ( self::getTableSchema ()->name . '.*' )
			->leftJoin ( OrganizationModel::getTableSchema ()->name, self::getTableSchema ()->name . '.organization_id=' . OrganizationModel::getTableSchema ()->name . '.id' );
			if ($condition)
			{
				$ar->where ( $condition );
			}
			// 			$ar->groupBy('id');
			return $ar->count();
		}
		else
			return 0;
	}
}

